<template>
    <el-container>
  <el-aside width="200px">
    <img src="../assets/log.jpg" style="height: 130px; width: 190px;">
    <el-row class="tac">
  <el-col :span="24">
    <el-menu
      default-active="2"
      class="el-menu-vertical-demo"
      @select="selectMenuItem"
      background-color="#001529"
      text-color="#fff"
      active-text-color="#ffd04b">
      <el-submenu index="1">
        <template slot="title">
          <i class="el-icon-s-management"></i>
          <span>日常防控管理</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/main/daka" v-if="xx==0">打卡记录</el-menu-item>
          <el-menu-item index="/main/submit" v-if="xx==1">健康打卡申报</el-menu-item>
          <el-menu-item index="/main/wuzi5" v-if="xx==1">防疫物资申报</el-menu-item>
          <el-menu-item index="/main/upload" v-if="xx==1">申请返校</el-menu-item>
          <el-menu-item index="/main/upload2" v-if="xx==0">返校申请</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
     
      <el-submenu index="2" v-if="xx==0">
        <template slot="title">
          <i class="el-icon-suitcase-1"></i>
          <span>物资管理</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/main/wuzi1">物资信息</el-menu-item>
          <el-menu-item index="/main/wuzi2">物资购买</el-menu-item>
          <el-menu-item index="/main/wuzi3">物资分配</el-menu-item>
       
         
          <el-menu-item index="/main/wuzi4">
            <el-badge :value="this.total" class="item">
            待处理申请
          </el-badge>
          </el-menu-item>
       
        </el-menu-item-group>
      </el-submenu>
      <el-submenu index="3" v-if="xx==0">
        <template slot="title">
          <i class="el-icon-user"></i>
          <span>人员管理</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/main/peoplemanage">权限管理</el-menu-item>
        
        </el-menu-item-group>
      </el-submenu>
      <el-submenu index="4" >
        <template slot="title">
          <i class="el-icon-user"></i>
          <span>在线聊天室</span>
        </template>
        <el-menu-item-group>
          <el-menu-item index="/main/liaotian">在线咨询</el-menu-item>
        
        </el-menu-item-group>
      </el-submenu>
    </el-menu>
  </el-col>
    </el-row>
  </el-aside>
  <el-container>
    
    <el-header>
      
      <el-dropdown class="caozuo">
       
        <span class="el-dropdown-link">
          <el-avatar :size="41" >
            <img src="../assets/QQ截图20220926200836.png"/></el-avatar>
     <span style="color:white">{{this.dengluming}}</span>
    </span>
  <el-dropdown-menu slot="dropdown"  >
   
    <el-dropdown-item @click.native="tuichu">退出</el-dropdown-item>
  </el-dropdown-menu>
</el-dropdown>
    </el-header>
    <el-main>
      <router-view/>  
    </el-main>
  </el-container>
</el-container>

</template>


<script>
  export default{
    data(){
      return {
             total:'',
             dengluming:'',
             xx:''
      }
      },
      created(){
         this.query() 
         this.dengluming=sessionStorage.getItem("user") 
         this.qqq();
        

        },
      methods:{
          selectMenuItem(index,indexPath){
                      console.log(index,indexPath);
                       this.$router.push({path: index});
          },
          query(){
            fetch("http://1.15.134.100:9999/wuzi3",{
              method:"GET",
              headers:{
                    'token': localStorage.getItem('token'),
                },

            })
            .then(res => res.json()).then(res =>{
              this.total=res.data.total
              
              
             
             

            })
        },
        tuichu(){
          var storage = window.localStorage;
          storage.clear();
          sessionStorage.removeItem("user")
          this.$router.replace({
                  path:'/login'
              });
          
        },
        qqq(){
          this.xx=localStorage.getItem('xx');
        }
      },
      
    }
  




</script>

<style>

.el-container{
    
    height: 100%;

}
.el-aside{
   background-color: #001529;
    
    
    height: 100%;

}

.el-header{
    background-color: #001529;
    height: 60px  !important;
    display: flex;


}
.caozuo{
  margin-left: 1160px;
 margin-top: 10px;
}


</style>